# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 45
n 45(None)[Item.__init__(self, displayed_name, type_, menu=menu, display_type=display_type)
self.related_item = related_item
self.preview_list = []
self.base_name = name
self.name_args = name_args
return None
]:
	i: 12(), 28()
	o: 

nname: 28
n 28(None)[displayed_name = _(name) % name_args
]:
	i: 0(f)
	o: 45()

nname: 12
n 12(None)[displayed_name = _(name)
]:
	i: 0(t)
	o: 45()

nname: 0
n 0(name_args is None)[]:
	i: 
	o: 12(t), 28(f)

nname: 0
n 0(None)[if name_args is None:
	displayed_name = _(name)
else:
	displayed_name = _(name) % name_args
Item.__init__(self, displayed_name, type_, menu=menu, display_type=display_type)
self.related_item = related_item
self.preview_list = []
self.base_name = name
self.name_args = name_args
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e296c>}
nname: 0
n 0(None)[return self.preview_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e22ec>}
nname: 103
n 103(None)[louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])
]:
	i: 67(), 102()
	o: 

nname: 102
n 102(None)[]:
	i: 0(f)
	o: 103()

nname: 67
n 67(None)[list = 'main_list'
options_selected = menu.selected_options
browse_method[list]()
menu.selected_options = options_selected
]:
	i: 56(), 63()
	o: 103()

nname: 63
n 63(None)[]:
	i: 45(f)
	o: 67()

nname: 56
n 56(None)[]:
	i: 45(t)
	o: 67()

nname: 45
n 45(menu['center_list'])[]:
	i: 0(t)
	o: 56(t), 63(f)

nname: 0
n 0(rebuild)[menu = self.menu
browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
]:
	i: 
	o: 45(t), 102(f)

nname: 103
n 103(None)[louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])
]:
	i: 45(), 0(f)
	o: 

nname: 45
n 45(None)[if menu['center_list']:
	pass
list = 'main_list'
options_selected = menu.selected_options
browse_method[list]()
menu.selected_options = options_selected
]:
	i: 0(t)
	o: 103()

nname: 0
n 0(rebuild)[menu = self.menu
browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
]:
	i: 
	o: 45(t), 103(f)

nname: 0
n 0(None)[menu = self.menu
browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
if rebuild:
	if menu['center_list']:
		pass
	list = 'main_list'
	options_selected = menu.selected_options
	browse_method[list]()
	menu.selected_options = options_selected
louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e2a8c>}
nname: 48
n 48(None)[louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])
]:
	i: 15(), 47()
	o: 

nname: 47
n 47(None)[]:
	i: 0(f)
	o: 48()

nname: 15
n 15(None)[center_selected = menu.selected_center
menu._browse_main()
menu.selected_center = center_selected
]:
	i: 0(t)
	o: 48()

nname: 0
n 0(rebuild)[menu = self.menu
]:
	i: 
	o: 15(t), 47(f)

nname: 0
n 0(None)[menu = self.menu
if rebuild:
	center_selected = menu.selected_center
	menu._browse_main()
	menu.selected_center = center_selected
louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e26ac>}
nname: 63
n 63(None)[return None
]:
	i: 15(), 37()
	o: 

nname: 37
n 37(None)[self._name = _(self.base_name) % self.name_args
]:
	i: 0(f)
	o: 63()

nname: 15
n 15(None)[self._name = _(self.base_name)
]:
	i: 0(t)
	o: 63()

nname: 0
n 0(self.name_args is None)[]:
	i: 
	o: 15(t), 37(f)

nname: 0
n 0(None)[if self.name_args is None:
	self._name = _(self.base_name)
else:
	self._name = _(self.base_name) % self.name_args
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e258c>}
nname: 6
n 6(None)[def __init__(self, name, type_='setupitem', menu=None, display_type=None, related_item=None, name_args=None):
	if name_args is None:
		displayed_name = _(name)
	else:
		displayed_name = _(name) % name_args
	Item.__init__(self, displayed_name, type_, menu=menu, display_type=display_type)
	self.related_item = related_item
	self.preview_list = []
	self.base_name = name
	self.name_args = name_args
	return None

def browse(self):
	return self.preview_list

def reload_options_list(self, rebuild=False):
	menu = self.menu
	browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
	if rebuild:
		if menu['center_list']:
			pass
		list = 'main_list'
		options_selected = menu.selected_options
		browse_method[list]()
		menu.selected_options = options_selected
	louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])

def reload_center_list(self, rebuild=False):
	menu = self.menu
	if rebuild:
		center_selected = menu.selected_center
		menu._browse_main()
		menu.selected_center = center_selected
	louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])

def update_name(self):
	if self.name_args is None:
		self._name = _(self.base_name)
	else:
		self._name = _(self.base_name) % self.name_args
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76dad2c>}
nname: 217
n 217(None)[]:
	i: 173(), 196(), 215(AE)
	o: 

nname: 215
n 215(None)[]:
	i: 186(f)
	o: 217(AE)

nname: 196
n 196(None)[#, e
PRINT_EXCEPTION(e)
]:
	i: 186(t)
	o: 217()

nname: 186
n 186(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 0(except)
	o: 196(t), 215(f)

nname: 173
n 173(None)[del _[1]
for self.preview_list in choices_list:
]:
	i: 49(AF), 142()
	o: 217()

nname: 142
n 142(None)[]:
	i: 80&131(t), 138()
	o: 173()

nname: 138
n 138(None)[]:
	i: 80&131(f)
	o: 142()

nname: 80&131
n 80&131(val == value and 'checked')[for val in choices_list:
]:
	i: 49(for)
	o: 138(f), 142(t)

nname: 49
n 49(None)[value = config.user_config[domain][key]
]:
	i: 0(try)
	o: 80&131(for), 173(AF)

nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
self.domain = domain
self.key = key
self.choices_list = choices_list
]:
	i: 
	o: 49(try), 186(except)

nname: 217
n 217(None)[]:
	i: 173(), 186()
	o: 

nname: 186
n 186(None)[except AttributeError, e:
	PRINT_EXCEPTION(e)
]:
	i: 0()
	o: 217()

nname: 173
n 173(None)[del _[1]
for self.preview_list in choices_list:
]:
	i: 0(AF), 80&131(t)
	o: 217()

nname: 80&131
n 80&131(None)[for val in choices_list:
if not(val == value and 'checked'):
	pass
]:
	i: 0(for)
	o: 173()

nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
self.domain = domain
self.key = key
self.choices_list = choices_list
try:
	value = config.user_config[domain][key]
]:
	i: 
	o: 80&131(for), 173(AF), 186()

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e2a8c>, '80&131': <unpyclib.structure.node instance at 0xb76e2ccc>, 173: <unpyclib.structure.node instance at 0xb76e2a4c>, 217: <unpyclib.structure.node instance at 0xb76674ec>, 186: <unpyclib.structure.node instance at 0xb76e2f8c>}
nname: 176
n 176(None)[]:
	i: 149(), 175()
	o: 

nname: 175
n 175(None)[]:
	i: 121&130(f)
	o: 176()

nname: 149
n 149(None)[self.menu._set_options_list(self, keep_selection=True)
]:
	i: 121&130(t)
	o: 176()

nname: 121&130
n 121&130(to_reload and len(to_reload) > 0)[to_reload = self.menu['options_list']
]:
	i: 69&82&96(t), 110()
	o: 149(t), 175(f)

nname: 110
n 110(None)[]:
	i: 69&82&96(f)
	o: 121&130()

nname: 69&82&96
n 69&82&96(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list'])[]:
	i: 51(), 68()
	o: 110(f), 121&130(t)

nname: 68
n 68(None)[]:
	i: 0(f)
	o: 69&82&96()

nname: 51
n 51(None)[self.execute_action(val)
]:
	i: 0(t)
	o: 69&82&96()

nname: 0
n 0(hasattr(self, 'execute_action'))[config.user_config[self.domain][self.key] = val
config.user_config.save()
]:
	i: 
	o: 51(t), 68(f)

nname: 121&130
n 121&130(None)[to_reload = self.menu['options_list']
if to_reload and len(to_reload) > 0:
	self.menu._set_options_list(self, keep_selection=True)
]:
	i: 0(t)
	o: 

nname: 0
n 0(None)[config.user_config[self.domain][self.key] = val
config.user_config.save()
if hasattr(self, 'execute_action'):
	self.execute_action(val)
if not(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list']):
	pass
]:
	i: 
	o: 121&130()

nname: 0
n 0(None)[config.user_config[self.domain][self.key] = val
config.user_config.save()
if hasattr(self, 'execute_action'):
	self.execute_action(val)
if not(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list']):
	pass
to_reload = self.menu['options_list']
if to_reload and len(to_reload) > 0:
	self.menu._set_options_list(self, keep_selection=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76676ec>}
nname: 121
n 121(None)[return self.preview_list
]:
	i: 0(AL), 120()
	o: 

nname: 120
n 120(None)[]:
	i: 26(AF), 111()
	o: 121()

nname: 111
n 111(None)[it.display_type = 'not_checked'
]:
	i: 51&100(t), 107()
	o: 120()

nname: 107
n 107(None)[]:
	i: 51&100(f)
	o: 111()

nname: 51&100
n 51&100(val == it.args[0] and 'checked')[for it, choice in itertools.izip(self.preview_list, self.choices_list):
it.name = self.translation_dict.get(choice)
]:
	i: 26(for)
	o: 107(f), 111(t)

nname: 26
n 26(None)[]:
	i: 0(loop)
	o: 51&100(for), 120(AF)

nname: 0
n 0(None)[val = config.user_config[self.domain][self.key]
]:
	i: 
	o: 26(loop), 121(AL)

nname: 121
n 121(None)[return self.preview_list
]:
	i: 0(AL), 26(AF), 51&100()
	o: 

nname: 51&100
n 51&100(None)[for it, choice in itertools.izip(self.preview_list, self.choices_list):
it.name = self.translation_dict.get(choice)
if not(val == it.args[0] and 'checked'):
	pass
it.display_type = 'not_checked'
]:
	i: 26(for)
	o: 121()

nname: 26
n 26(None)[]:
	i: 0(loop)
	o: 51&100(for), 121(AF)

nname: 0
n 0(None)[val = config.user_config[self.domain][self.key]
]:
	i: 
	o: 26(loop), 121(AL)

nname: 51&100
n 51&100(None)[for it, choice in itertools.izip(self.preview_list, self.choices_list):
	it.name = self.translation_dict.get(choice)
	if not(val == it.args[0] and 'checked'):
		pass
	it.display_type = 'not_checked'
return self.preview_list
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[val = config.user_config[self.domain][self.key]
]:
	i: 
	o: 51&100(for)

nname: 0
n 0(None)[val = config.user_config[self.domain][self.key]
for it, choice in itertools.izip(self.preview_list, self.choices_list):
	it.name = self.translation_dict.get(choice)
	if not(val == it.args[0] and 'checked'):
		pass
	it.display_type = 'not_checked'
return self.preview_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7667a4c>}
nname: 6
n 6(None)[def __init__(self, domain, key, choices_list, *args, **args):
	ParametersSetupItem.__init__(self, *args, **kw)
	self.domain = domain
	self.key = key
	self.choices_list = choices_list
	try:
		value = config.user_config[domain][key]

def _select_option(self, val):
	config.user_config[self.domain][self.key] = val
	config.user_config.save()
	if hasattr(self, 'execute_action'):
		self.execute_action(val)
	if not(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list']):
		pass
	to_reload = self.menu['options_list']
	if to_reload and len(to_reload) > 0:
		self.menu._set_options_list(self, keep_selection=True)

def browse(self):
	val = config.user_config[self.domain][self.key]
	for it, choice in itertools.izip(self.preview_list, self.choices_list):
		it.name = self.translation_dict.get(choice)
		if not(val == it.args[0] and 'checked'):
			pass
		it.display_type = 'not_checked'
	return self.preview_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76daaec>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({True: 'ON', False: 'OFF'})
]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76dae6c>}
nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
self.domain = domain
self.key = key
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb766784c>}
nname: 245
n 245(None)[self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 210(JA), 227(JA), 241(), 244()
	o: 

nname: 244
n 244(None)[]:
	i: 191(f)
	o: 245()

nname: 227
n 227(None)[PRINT_EXCEPTION()
]:
	i: 206(except)
	o: 245(JA)

nname: 210
n 210(None)[self.execute_action(result)
]:
	i: 206(try)
	o: 245(JA)

nname: 206
n 206(None)[]:
	i: 191(t)
	o: 210(try), 227(except)

nname: 191
n 191(hasattr(self, 'execute_action'))[]:
	i: 135(), 184(), 190(AE)
	o: 206(t), 244(f)

nname: 184
n 184(None)[]:
	i: 126(except)
	o: 191()

nname: 135
n 135(None)[config.user_config.save()
]:
	i: 126(try)
	o: 191()

nname: 126
n 126(None)[del _[1]
for result in self.menu.available_choices:
]:
	i: 0(AF), 122()
	o: 135(try), 184(except)

nname: 122
n 122(None)[]:
	i: 32&59(f), 81()
	o: 126()

nname: 81
n 81(None)[continue
]:
	i: 32&59(t)
	o: 122()

nname: 32&59
n 32&59(hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None)[for choices in self.menu.available_choices:
]:
	i: 0(for)
	o: 81(t), 122(f)

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 32&59(for), 126(AF)

nname: 245
n 245(None)[self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 227(JA), 241(), 184(f)
	o: 

nname: 227
n 227(None)[except:
	PRINT_EXCEPTION()
]:
	i: 206()
	o: 245(JA)

nname: 206
n 206(None)[try:
	self.execute_action(result)
]:
	i: 184(t)
	o: 227()

nname: 184
n 184(hasattr(self, 'execute_action'))[except:
	pass
]:
	i: 126()
	o: 206(t), 245(f)

nname: 126
n 126(None)[del _[1]
for result in self.menu.available_choices:
try:
	config.user_config.save()
]:
	i: 0(AF), 32&59(f)
	o: 184()

nname: 32&59
n 32&59(None)[for choices in self.menu.available_choices:
if hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None:
	continue
]:
	i: 0(for)
	o: 126()

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 32&59(for), 126(AF)

nname: 245
n 245(None)[self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 206(JA), 241(), 126(f)
	o: 

nname: 206
n 206(None)[try:
	self.execute_action(result)
except:
	PRINT_EXCEPTION()
]:
	i: 126(t)
	o: 245(JA)

nname: 126
n 126(hasattr(self, 'execute_action'))[del _[1]
for result in self.menu.available_choices:
try:
	config.user_config.save()
except:
	pass
]:
	i: 0(AF), 32&59(f)
	o: 206(t), 245(f)

nname: 32&59
n 32&59(None)[for choices in self.menu.available_choices:
if hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None:
	continue
]:
	i: 0(for)
	o: 126()

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 32&59(for), 126(AF)

nname: 245
n 245(None)[self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 241(), 126(f)
	o: 

nname: 126
n 126(None)[del _[1]
for result in self.menu.available_choices:
try:
	config.user_config.save()
except:
	pass
if hasattr(self, 'execute_action'):
	try:
		self.execute_action(result)
	except:
		PRINT_EXCEPTION()
]:
	i: 0(AF), 32&59(f)
	o: 245(JA)

nname: 32&59
n 32&59(None)[for choices in self.menu.available_choices:
if hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None:
	continue
]:
	i: 0(for)
	o: 126()

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 32&59(for), 126(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e236c>, 241: <unpyclib.structure.node instance at 0xb76e246c>, 240: <unpyclib.structure.node instance at 0xb76e2a2c>, 245: <unpyclib.structure.node instance at 0xb76e22ec>, '32&59': <unpyclib.structure.node instance at 0xb766db6c>, 126: <unpyclib.structure.node instance at 0xb766d72c>}
nname: 6
n 6(None)[__doc__ = 'Acts like UserConfigSetupItem but not construct ActionItem\n    preview_list must be filled with a browseable item\n    '
def __init__(self, domain, key, *args, **args):
	ParametersSetupItem.__init__(self, *args, **kw)
	self.domain = domain
	self.key = key

def _select_option(self, *args, **args):
	get_it = self.menu.get_item_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76daf6c>}
nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
self.domain = domain
self.key = key
self.entered_value = None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76dab6c>}
nname: 0
n 0(None)[return config.user_config[self.domain][self.key] == self.entered_value
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76daf8c>}
nname: 132
n 132(None)[del _[1]
self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 0(AF), 128()
	o: 

nname: 128
n 128(None)[]:
	i: 38&65(f), 87()
	o: 132()

nname: 87
n 87(None)[continue
]:
	i: 38&65(t)
	o: 128()

nname: 38&65
n 38&65(hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None)[for choices in self.menu.available_choices:
]:
	i: 0(for)
	o: 87(t), 128(f)

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 38&65(for), 132(AF)

nname: 132
n 132(None)[del _[1]
self.menu._set_options_list(self, keep_selection=True)
return None
]:
	i: 0(AF), 38&65(f)
	o: 

nname: 38&65
n 38&65(None)[for choices in self.menu.available_choices:
if hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None:
	continue
]:
	i: 0(for)
	o: 132()

nname: 0
n 0(None)[get_it = self.menu.get_item_list
]:
	i: 
	o: 38&65(for), 132(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7667d0c>, 132: <unpyclib.structure.node instance at 0xb7667a2c>, '38&65': <unpyclib.structure.node instance at 0xb7667c8c>}
nname: 6
n 6(None)[__doc__ = " Item that handle a Container Item (as UserConfigSetupMultipleItem) but no writes\n    in config the entered value. It can check if entered value is the same as config's one"
def __init__(self, domain, key, *args, **args):
	ParametersSetupItem.__init__(self, *args, **kw)
	self.domain = domain
	self.key = key
	self.entered_value = None
	return None

def check_entered_value(self):
	return config.user_config[self.domain][self.key] == self.entered_value

def _select_option(self, *args, **args):
	get_it = self.menu.get_item_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76dad0c>}
nname: 54
n 54(None)[GenericContainer.__init__(self, name, type_='parameter', **kw)
]:
	i: 15(), 44()
	o: 

nname: 44
n 44(None)[self.iter_ = iter_
]:
	i: 0(t)
	o: 54()

nname: 15
n 15(None)[self.iter_ = dict(<genexpr>(iter_))
]:
	i: 0(f)
	o: 54()

nname: 0
n 0(isinstance(iter_, dict))[]:
	i: 
	o: 15(f), 44(t)

nname: 0
n 0(None)[if not isinstance(iter_, dict):
	self.iter_ = dict(<genexpr>(iter_))
else:
	self.iter_ = iter_
GenericContainer.__init__(self, name, type_='parameter', **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76673cc>}
nname: 108
n 108(None)[del _[1]
return sorted(self.iter_)
]:
	i: 0(AF), 23()
	o: 

nname: 23
n 23(None)[for i in sorted(self.iter_):
]:
	i: 0(for)
	o: 108()

nname: 0
n 0(None)[]:
	i: 
	o: 23(for), 108(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7667f2c>, 108: <unpyclib.structure.node instance at 0xb766796c>, 23: <unpyclib.structure.node instance at 0xb766704c>}
nname: 6
n 6(None)[__doc__ = 'Class that handle a container of ActionItems which values\n    are in a iterable.\n    If iterable is not a dict (e.g. list, tuple, xrange, ...), it is\n    transformed in a dict which items are (elt, str(elt))\n    '
def __init__(self, name, iter_, **kw):
	if not isinstance(iter_, dict):
		self.iter_ = dict(<genexpr>(iter_))
	else:
		self.iter_ = iter_
	GenericContainer.__init__(self, name, type_='parameter', **kw)

def browse(self):
	pass

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76daf2c>}
nname: 0
n 0(None)[from __future__ import absolute_import
import itertools
import pygui.config as config
from ..core import ActionItem, Item
from peewee.debug import PRINT_EXCEPTION
from peewee.messages import send as louie_send
from pygui.item.containers import GenericContainer
from pygui.facilities.l10n import UnicodeDict
class ParametersSetupItem(Item):
	def __init__(self, name, type_='setupitem', menu=None, display_type=None, related_item=None, name_args=None):
		if name_args is None:
			displayed_name = _(name)
		else:
			displayed_name = _(name) % name_args
		Item.__init__(self, displayed_name, type_, menu=menu, display_type=display_type)
		self.related_item = related_item
		self.preview_list = []
		self.base_name = name
		self.name_args = name_args
		return None

	def browse(self):
		return self.preview_list

	def reload_options_list(self, rebuild=False):
		menu = self.menu
		browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
		if rebuild:
			if menu['center_list']:
				pass
			list = 'main_list'
			options_selected = menu.selected_options
			browse_method[list]()
			menu.selected_options = options_selected
		louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])

	def reload_center_list(self, rebuild=False):
		menu = self.menu
		if rebuild:
			center_selected = menu.selected_center
			menu._browse_main()
			menu.selected_center = center_selected
		louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])

	def update_name(self):
		if self.name_args is None:
			self._name = _(self.base_name)
		else:
			self._name = _(self.base_name) % self.name_args
		return None



class UserConfigSetupItem(ParametersSetupItem):
	def __init__(self, domain, key, choices_list, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key
		self.choices_list = choices_list
		try:
			value = config.user_config[domain][key]

	def _select_option(self, val):
		config.user_config[self.domain][self.key] = val
		config.user_config.save()
		if hasattr(self, 'execute_action'):
			self.execute_action(val)
		if not(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list']):
			pass
		to_reload = self.menu['options_list']
		if to_reload and len(to_reload) > 0:
			self.menu._set_options_list(self, keep_selection=True)

	def browse(self):
		val = config.user_config[self.domain][self.key]
		for it, choice in itertools.izip(self.preview_list, self.choices_list):
			it.name = self.translation_dict.get(choice)
			if not(val == it.args[0] and 'checked'):
				pass
			it.display_type = 'not_checked'
		return self.preview_list



class BooleanUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({True: 'ON', False: 'OFF'})


class UserConfigSetupMultipleItem(ParametersSetupItem):
	__doc__ = 'Acts like UserConfigSetupItem but not construct ActionItem\n    preview_list must be filled with a browseable item\n    '
	def __init__(self, domain, key, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key

	def _select_option(self, *args, **args):
		get_it = self.menu.get_item_list



class UserConfigSetupCheckMultipleItem(ParametersSetupItem):
	__doc__ = " Item that handle a Container Item (as UserConfigSetupMultipleItem) but no writes\n    in config the entered value. It can check if entered value is the same as config's one"
	def __init__(self, domain, key, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key
		self.entered_value = None
		return None

	def check_entered_value(self):
		return config.user_config[self.domain][self.key] == self.entered_value

	def _select_option(self, *args, **args):
		get_it = self.menu.get_item_list



class IterItemContainer(GenericContainer):
	__doc__ = 'Class that handle a container of ActionItems which values\n    are in a iterable.\n    If iterable is not a dict (e.g. list, tuple, xrange, ...), it is\n    transformed in a dict which items are (elt, str(elt))\n    '
	def __init__(self, name, iter_, **kw):
		if not isinstance(iter_, dict):
			self.iter_ = dict(<genexpr>(iter_))
		else:
			self.iter_ = iter_
		GenericContainer.__init__(self, name, type_='parameter', **kw)

	def browse(self):
		pass



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76d496c>}
from __future__ import absolute_import
import itertools
import pygui.config as config
from ..core import ActionItem, Item
from peewee.debug import PRINT_EXCEPTION
from peewee.messages import send as louie_send
from pygui.item.containers import GenericContainer
from pygui.facilities.l10n import UnicodeDict
class ParametersSetupItem(Item):
	def __init__(self, name, type_='setupitem', menu=None, display_type=None, related_item=None, name_args=None):
		if name_args is None:
			displayed_name = _(name)
		else:
			displayed_name = _(name) % name_args
		Item.__init__(self, displayed_name, type_, menu=menu, display_type=display_type)
		self.related_item = related_item
		self.preview_list = []
		self.base_name = name
		self.name_args = name_args
		return None

	def browse(self):
		return self.preview_list

	def reload_options_list(self, rebuild=False):
		menu = self.menu
		browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main}
		if rebuild:
			if menu['center_list']:
				pass
			list = 'main_list'
			options_selected = menu.selected_options
			browse_method[list]()
			menu.selected_options = options_selected
		louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])

	def reload_center_list(self, rebuild=False):
		menu = self.menu
		if rebuild:
			center_selected = menu.selected_center
			menu._browse_main()
			menu.selected_center = center_selected
		louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])

	def update_name(self):
		if self.name_args is None:
			self._name = _(self.base_name)
		else:
			self._name = _(self.base_name) % self.name_args
		return None



class UserConfigSetupItem(ParametersSetupItem):
	def __init__(self, domain, key, choices_list, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key
		self.choices_list = choices_list
		try:
			value = config.user_config[domain][key]

	def _select_option(self, val):
		config.user_config[self.domain][self.key] = val
		config.user_config.save()
		if hasattr(self, 'execute_action'):
			self.execute_action(val)
		if not(self.menu['options_list'] or self.menu['options0_list'] or self.menu['aspect_ratio_list']):
			pass
		to_reload = self.menu['options_list']
		if to_reload and len(to_reload) > 0:
			self.menu._set_options_list(self, keep_selection=True)

	def browse(self):
		val = config.user_config[self.domain][self.key]
		for it, choice in itertools.izip(self.preview_list, self.choices_list):
			it.name = self.translation_dict.get(choice)
			if not(val == it.args[0] and 'checked'):
				pass
			it.display_type = 'not_checked'
		return self.preview_list



class BooleanUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({True: 'ON', False: 'OFF'})


class UserConfigSetupMultipleItem(ParametersSetupItem):
	__doc__ = 'Acts like UserConfigSetupItem but not construct ActionItem\n    preview_list must be filled with a browseable item\n    '
	def __init__(self, domain, key, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key

	def _select_option(self, *args, **args):
		get_it = self.menu.get_item_list



class UserConfigSetupCheckMultipleItem(ParametersSetupItem):
	__doc__ = " Item that handle a Container Item (as UserConfigSetupMultipleItem) but no writes\n    in config the entered value. It can check if entered value is the same as config's one"
	def __init__(self, domain, key, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.domain = domain
		self.key = key
		self.entered_value = None
		return None

	def check_entered_value(self):
		return config.user_config[self.domain][self.key] == self.entered_value

	def _select_option(self, *args, **args):
		get_it = self.menu.get_item_list



class IterItemContainer(GenericContainer):
	__doc__ = 'Class that handle a container of ActionItems which values\n    are in a iterable.\n    If iterable is not a dict (e.g. list, tuple, xrange, ...), it is\n    transformed in a dict which items are (elt, str(elt))\n    '
	def __init__(self, name, iter_, **kw):
		if not isinstance(iter_, dict):
			self.iter_ = dict(<genexpr>(iter_))
		else:
			self.iter_ = iter_
		GenericContainer.__init__(self, name, type_='parameter', **kw)

	def browse(self):
		pass



